package com.itheima.day05.mysystem.test1;

import java.util.ArrayList;

/*
    //public static void exit​(int status)	终止当前运行的 Java 虚拟机，非零表示异常终止
    //public static long currentTimeMillis​()	返回当前时间(以毫秒为单位)
    //Public static void arraycopy(Object src, int srcPos, Object dest, int destPos, int length)从指定源数组中复制一个数组，复制从指定的位置开始，到目标数组的指定位置结束
 */
public class Test {
    public static void main(String[] args) {
        // public static void exit​(int status)	终止当前运行的 Java 虚拟机，非零表示异常终止
        /*System.out.println("aaa");
        System.exit(0);
        System.out.println("bbb");
        */
        // public static long currentTimeMillis​()	返回当前时间(以毫秒为单位)
        /*StringBuilder sb = new StringBuilder();
        long start = System.currentTimeMillis();
        for (int i = 0; i < 50000; i++) {
            sb.append(i);
        }
        *//*String str = " ";
        for (int i = 0; i < 50000; i++) {
            str += i;
        }*//*
        long end = System.currentTimeMillis();
        System.out.println(end - start);*/
        /*
         Public static void arraycopy(Object src, int srcPos, Object dest, int destPos, int length)
                                      数据源数组   起始索引     目的地数组    起始索引      拷贝个数
                  从指定源数组中复制一个数组，复制从指定的位置开始，到目标数组的指定位置结束
        */
        int[] arr1 = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20};
        int[] arr2 = new int[arr1.length];
        System.arraycopy(arr1, arr1.length - 2, arr2, arr2.length - 2, arr1.length - (arr1.length - 2));
        System.out.print("[");
        for (int i = 0; i < arr2.length; i++) {
            if (i == arr2.length - 1) {
                System.out.print(arr2[i]);
                break;
            }
            System.out.print(arr2[i] + ", ");
        }
        System.out.println("]");
    }
}
